package com.label.Config.MyBatis;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import org.springframework.stereotype.Component;

// 自定义id生成策略的类
// IdentifierGenerator 接口提供 generate 方法：用来生成主键
// Configurable 接口提供 configure 方法：用来接收参数
@Component
public class MyIdGenerator implements IdentifierGenerator {

    @Override
    public Number nextId(Object entity) {
        return IdGenerator.generateId();
    }

    @Override
    public String nextUUID(Object entity) {
        return String.valueOf(IdGenerator.generateId());
    }
}